<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org"
      th:replace="~{fragments/layout :: layout (~{::body},'patients')}">

<body>


<h2>Patient Information</h2>


<table class="table table-striped" th:object="${patient}">
    <tr>
        <th>Name</th>
        <td><b th:text="*{firstName + ' ' + lastName}"></b></td>
    </tr>
    <tr>
        <th>Address</th>
        <td th:text="*{address}"/>
        </td>
    </tr>
    <tr>
        <th>Telephone</th>
        <td th:text="*{phoneNumber}"/>
        </td>
    </tr>
</table>

<a th:href="@{{id}/edit(id=${patient.id})}" class="btn btn-default">Edit
    Owner</a>

<br/>
<br/>
<br/>
<h2>Visits</h2>

<table class="table table-striped">

    <td valign="top">
        <table class="table-condensed">
            <thead>
            <tr>
                <th>Visit Date</th>
                <th>Description</th>
            </tr>
            </thead>
            <tr th:each="visit : ${patient.visits}">
                <td th:text="${#temporals.format(visit.localDate, 'yyyy/MM/dd')}"></td>
                <td th:text="${visit?.description}"></td>
            </tr>
            <tr>
                <td><a
                        th:href="@{/patients/{patientId}/visits/new(patientId=${patient.id})}">Add Visit</a></td>
            </tr>
        </table>
    </td>
    </tr>

</table>

</body>

</html>
